import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class Test {
    public static void main(String[] args) {
//        String json = "{\"msg\":\"\",\"results\":[{\"data\":[{\"bottom\":202.7095947265625,\"confidence\":0.9999841451644897,\"left\":233.6475830078125,\"right\":272.310791015625,\"top\":156.3901824951172}]}],\"status\":\"0\"}";
        String json = JsonUtils.getJson("src\\main\\resources\\tmp\\test.json");
        // get array[{'data':[...]}]
        JSONArray array = JSONObject.parseObject(json).getJSONArray("results");
        // get {'data':[...]}
        String s = array.getString(0);
        // get [(坐标obj的列表)]
        JSONArray posObjList = JSONObject.parseObject(s).getJSONArray("data");
        for (int i = 0; i < posObjList.size(); i++) {
            //单个坐标
            String pos = posObjList.getString(i);
            JSONObject p = JSONObject.parseObject(pos);
            Double top = p.getDouble("top");
            Double left = p.getDouble("left");
            Double bottom = p.getDouble("bottom");
            Double right = p.getDouble("right");
            System.out.println("left: "+left+" right: "+right+" bottom: "+bottom+" top: "+top);
        }
    }
}
